    // pages/component/footer/footer.js

    const app = getApp()


    Component({
      /**
      * 组件的属性列表
      */
      properties: {},
      ready: function () {
        var obj = app.globalData
        var that = this
        that.setData({
          loginState: app.globalData.loginState
        })
        Object.defineProperty(obj, "loginState", {
          get: function (val) {
          },
          set: function (newValue) {
            that.setData({
              loginState: newValue
            })
          },
          enumerable: true,
          configurable: true
        });
      },
      /**
      * 组件的初始数据
      */
      data: {
        list: [
          {
            name: '首页',
            url: '../index/index',
            img: './img/index.png'
          },
          {
            name: '品牌批发',
            url: '../wholesale/wholesale',
            img: './img/pf.png'
          },
          {
            name: '购物车',
            url: '../car/car',
            img: './img/car.png'
          },
          {
            name: '我的',
            url: '../my/my',
            img: './img/my.png'
          },
          
        ],
        loginState: false,
        weizhi: false,
        animationdata:{}
      },

      /**
      * 组件的方法列表
      */
      methods: {
        change_wei:function(){
         var that = this;
          console.log(123)
          this.setData({
            weizhi:true
          })
          setTimeout(function(){
            that.setData({
              weizhi: false
            })
          },5000)
        },
        toLink(e) {
          let url = e.currentTarget.dataset.url
          if (url == '../service/service') {
            return
          }
          if (url == '../car/car') {
            wx.navigateTo({
              url: url
            })
            return
          }
          wx.reLaunch({
            url: url
          })
        },


        onGotUserInfo: function (e) {
          let that = this
          console.log(e.detail.userInfo, app.globalData.code)
          if (e.detail.userInfo) {
            wx.showLoading({
              title: '加载中',
              mask: true
            })
            app.globalData.loginState = false
            that.setData({
              loginState: false
            })
            wx.request({
              url: app.globalData.url + 'wxlogin.php',
              data: {
                name:
                JSON.stringify({
                  code: app.globalData.code,
                  user: e.detail.userInfo
                })
              },
              method: 'POST',
              header: {
                'content-type': 'application/x-www-form-urlencoded' // 默认值
              },
              
              success: function (loginOk) {
                console.log(loginOk)
                wx.setStorageSync('opid', loginOk.data.openid)
                wx.setStorageSync('userStatus', loginOk.data.user_rank)
                wx.setStorageSync('userInfo', e.detail.userInfo)
                app.globalData.opid = loginOk.data.openid
                app.globalData.userStatus = loginOk.data.user_rank
                app.globalData.userInfo = e.detail.userInfo
                wx.hideLoading()
                console.log(loginOk)
              },
              fail:function(res){
                console.log(res)
              }
            })
          }
          else {
            wx.showModal({
              title: '用户信息授权失败，请重新授权',
              content: '为了更好的为你提供服务，我们申请获得你的公开用户信息（昵称，头像）',
              showCancel: false,
              confirmText: '去授权',
              success: function (res) {
                console.log(res)
                if (res.confirm) {
                  console.log('jin')
                  wx.openSetting({

                    success: (res) => {
                      coonsole.log(res)
                      if (res.authSetting["scope.userInfo"]) {
                        app.globalData.loginState = false
                        app.globalData.loginFn(e.detail.userInfo)
                        wx.getSetting({
                          success(res) {
                            res.authSetting['scope.userInfo'] = false
                          }
                        })

                      }
                    },
                    fail:function(res){
                      console.log(res)
                    }

                  })
                }
              }
            })
          }
        },
      }
    })
